package com.yinhai.httpclient;

import org.apache.http.HttpVersion;
import org.apache.http.ProtocolVersion;

public class HttpApplicationContext {
	/**
	 * 连接方式
	 *  1 ：使用HttpClient连接池
	 *  2：直接使用Httpclient
	 *  3：使用HttpURLConnection
	 */
	public static final int HTTPCLIENT_CONNECTION_TYPE = 1;  
	
	/**
	 * 是否支持https
	 */
	public static final boolean HTTPCLIENT_CONN_SSL = true;
	
	//httpclient connection 
	public static final int HTTPCLIENT_CONN_MAXPERROUTE = 5;
	
	public static final String HTTPCLIENT_ENGINE_CONTENTCHARSET = "utf-8";
	
	public static final String HTTPCLIENT_ENGINE_HTTPELEMENTCHARSET = "utf-8";
	
	public static final int HTTPCLIENT_CONN_MAXTOTALCONN = 20;
	
	public static final long HTTPCLIENT_CONN_IDLESECEND = 2L;
	
	public static final long HTTPCLIENT_CONN_TIMERMSEL = 2000L;
	
	//httpclient engine
	public static final boolean HTTPCLIENT_ENGINE_USEEXPECTCONTINUE = false;
	
	public static final String HTTPCLIENT_ENGINE_USERAGENT = "";
	
	public static final ProtocolVersion HTTPCLIENT_ENGINE_VERSION = HttpVersion.HTTP_1_1;
	
	public static final int HTTPCLIENT_ENGINE_CONNECTIONTIMEOUT = 20000;
	
	public static final int HTTPCLIENT_ENGINE_LINGER = 5;
	
	public static final int HTTPCLIENT_ENGINE_SOCKETBUFFERSIZE = 8192;
	
	public static final int HTTPCLIENT_ENGINE_SOTIMEOUT = 30000;
	
	public static final boolean HTTPCLIENT_ENGINE_STALECHECKINGENABLED = true;
	
	public static final boolean HTTPCLIENT_ENGINE_TCPNODELAY = true;
	
	//application
	/**
	 * 网络请求状态；0：成功；1：失败
	 */
	public static final String REQUEST_STATUS = "REQUEST_STATUS";
	
	/**
	 * 请求成功
	 */
	public static final String REQUEST_OK = "0";
	
	/**
	 *请求失败 
	 */
	public static final String REQUEST_FAILURE = "1";
	
	/**
	 * 返回内容
	 */
	public static final String RESPONSE_CONTENT ="RESPONSE_CONTENT";
	
	/**
	 * 返回byte[]
	 */
	public static final String RESPONSE_BYTE ="RESPONSE_BYTE";
	
	/**
	 * 返回cookie
	 */
	public static final String RESPONSE_COOKIE_STORE ="RESPONSE_COOKIE_STORE";
	
	/**
	 * 请求重试次数
	 */
	public static final int RETRY_COUNT = 2;
}
